package com.multipleThread.myRestaurant;

import lombok.Data;

import javax.annotation.Generated;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 罗俊华
 * @date 2021/4/29 - 1:48 下午
 */
@Data
public class Table {

    private static final AtomicInteger count = new AtomicInteger();

    private int tableId = count.getAndIncrement();

    private final List<Customer> customers = new ArrayList<>();
    //新上的菜
    private final BlockingQueue<Plate> newFoodQueue = new SynchronousQueue<>();

    public synchronized void addCustomer(Customer customer) {

        this.customers.add(customer);
    }

    public synchronized void addCustomers(List<Customer> customers) {

        this.customers.addAll(customers);
    }
}
